package org.seckill.dao;

import org.apache.ibatis.annotations.Param;
import org.seckill.annotation.MyBatisDao;
import org.seckill.entity.Seckill;

import java.util.Date;
import java.util.List;

/**
 * Created by TheSixOneNine on 2017/2/8.
 * @author simple
 */
@MyBatisDao
public interface SeckillDao {
    /**
     * 减库存
     *
     * @param seckillId
     * @param killTime
     * @return表示更新的行数
     */
    int reduceNumber(@Param("seckillId") long seckillId, @Param("killTime") Date killTime);

    /**
     * 根据seckillId查询Seckill
     *
     * @param seckillId
     * @return Seckill
     */
    Seckill queryById(long seckillId);

    /**
     * 根据偏移量查询秒杀记录
     *
     * @param offset
     * @param limit
     * @return List<Seckill>
     */
    List<Seckill> queryAll(@Param("offset") int offset, @Param("limit") int limit);
}
